package com.example.datadashboard.enums;

/**
 * 性别枚举：0-男性，1-女性
 */
public enum GenderEnum {
    MALE(0, "男性"),
    FEMALE(1, "女性");

    private final int code;
    private final String desc;

    GenderEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static GenderEnum fromCode(Integer code) {
        if (code == null) return null;
        for (GenderEnum g : values()) {
            if (g.code == code) return g;
        }
        return null;
    }
}